var express = require('express');
var router = express.Router();

// var connection = mysql.createConnection({
//   host: 'localhost',
//   user: 'root',
//   password: '123',
//   database: 'demo'
// });
// connection.connect();


/* GET home page. */
router.get('/', function (req, res, next) {
  res.render('index', {title: '吹牛拍马'});
});

router.get('/process_get', function (req, res) {
  // 输出 JSON 格式
  var response = {
    "first_name": req.query.first_name,
    "last_name": req.query.last_name
  };
  console.log(response);
  res.send(JSON.stringify(response));
});

module.exports = router;
